capture program drop sumtable
 program define sumtable
 syntax varlist using [, replace append ]
 tempname fh
 file open `fh' `using', write `replace' `append'
 file write `fh' "variable" _tab "N" _tab "mean"
 foreach v of local varlist {
 quietly summarize `v'
 file write `fh' _n "`v'" _tab (r(N)) _tab (r(mean)) _tab (r(sd))
 }
 file close `fh'
 end

capture program drop centiletable
 program define centiletable
 syntax varlist using [, replace append ]
 tempname fh
 file open `fh' `using', write `replace' `append'
 file write `fh' _tab "variable" _tab "Lower Bound" _tab "Upper Bound"
 foreach v of local varlist {
 quietly centile `v', centile(2.5 97.5)
 file write `fh' _n "`v'" _tab (r(c_1)) _tab (r(c_2))
 }
 file close `fh'
 end
 
